<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
  <meta name="generator" content=
  "HTML Tidy for Linux/x86 (vers 1 September 2005), see www.w3.org">

  <title>swap_ranges</title>
  <link href="../cppreference.css" rel="stylesheet" type="text/css">
</head>

<body>
<table>
  <tr>
  <td>
  <div class="body-content">

  <div class="header-box">
    <a href="../index.html">cppreference.com</a> &gt; <a href=
    "index.html">C++ Algorithms</a> &gt; <a href=
    "swap_ranges.html">swap_ranges</a>
  </div>

  <div class="name-format">
    swap_ranges
  </div>

  <div class="syntax-name-format">
    Syntax:
  </div>
  <pre class="syntax-box">
  #include &lt;algorithm&gt;
  iterator swap_ranges( iterator start1, iterator end1, iterator start2 );
</pre>

  <p>The swap_ranges() function exchanges the elements in the range
  [<em>start1</em>,<em>end1</em>) with the range of the same size
  starting at <em>start2</em>.</p>

  <p>The return value of swap_ranges() is an iterator to
  <em>start2</em> + (<em>end1</em>-<em>start1</em>).</p>

  <div class="related-name-format">
    Related topics:
  </div>

  <div class="related-content">
    <a href="iter_swap.html">iter_swap</a><br>
    <a href="swap.html">swap</a>
  </div>
  </div>
  </td>
  


  </tr>
  </table>
</body></html>
